<?php
namespace Rate\Controller;
use Todo\Controller\CurdController;

class NormController extends CurdController {

    public function _before_add(){
        $tplId = I('get.tpl_id/d');
        if($tplId){
            $this->assign('template', D('Todo/Rate/Template')->keyFind($tplId));
        }
    }

    /**
     * 获取要编辑的数据，建议重写
     * @param $id
     * @return mixed
     */
    protected function _editData($id){
        $this->_loadModel();
        $data = $this->_model->keyFind($id);
        $this->assign('template', D('Todo/Rate/Template')->keyFind($data['tpl_id']));
        return $data;
    }
}